﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace EuphoricEngine3D
{
    public class GameBase3D : Microsoft.Xna.Framework.Game
    {
        #region Fields

        private Engine _engine;
        private GraphicsDeviceManager _graphics;

        SpriteFont _consoleFont;
        private string _consoleFontPath;

        #endregion

        #region Constructor

        public GameBase3D(string windowTitle, string consoleFontPath)
        {
            _graphics = new GraphicsDeviceManager(this);
            Window.Title = windowTitle;
            _consoleFontPath = consoleFontPath;
        }

        #endregion

        #region Content Management

        protected override void LoadContent()
        {
            _consoleFont = Content.Load<SpriteFont>("Content\\" + _consoleFontPath);
            _engine = new Engine(this, "ConsoleFont", Graphics, "Content");
        }

        #endregion

        #region Update

        protected override void Update(GameTime gameTime)
        {
            _engine.Update(gameTime);

            base.Update(gameTime);
        }

        #endregion

        #region Draw

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            _engine.Draw(gameTime);            

            base.Draw(gameTime);
        }

        #endregion

        #region Properties

        public GraphicsDeviceManager Graphics
        {
            get { return _graphics; }
        }

        public Engine Engine
        {
            get { return _engine; }
        }

        #endregion
    }
}
